// 自定义hover
// o-hover="className"

export default {
    bind: function(node, directive, vnode){
        // 接受入参
        var value = directive.value;
        // 准备方法
        var addClass = function () {
            Yox.dom.addClass(node, directive.value);
        };
        var removeClass = function () {
            Yox.dom.removeClass(node, directive.value);
        };
        // 将方法绑定到监听事件中
        Yox.dom.on(node, 'mouseover', addClass);
        Yox.dom.on(node, 'mouseout', removeClass);

        // 销毁函数
        vnode.data[directive.key] = function(){
            Yox.dom.off(node, 'mouseover', addClass);
            Yox.dom.off(node, 'mouseout', removeClass);
        }
    },
    unbind: function(node, directive, vnode){
        vnode.data[directive.key]()
    }
}